package com.sunflower.bath.service.impl;
import java.util.List;
import org.framework.mybatis.Criteria;
import org.sunflower.framework.utils.UUIDUtils;

import com.sunflower.bath.model.JobTimer;
import com.sunflower.bath.service.IJobTimerService;
import com.sunflower.bath.repository.IJobTimerRepository;

public class JobTimerServiceImpl implements IJobTimerService{

	public List<JobTimer> queryPage(Criteria<JobTimer> param){
		List<JobTimer> list = jobTimerRepository.queryPage(param); 
		return list;  }

	public Integer queryPageCount(Criteria<JobTimer> param){
		return (Integer) jobTimerRepository.queryPageCount(param);
	}

	public JobTimer queryEntityById(String id){
		return jobTimerRepository.queryEntityById(id);
	}

	public String insert(JobTimer record){
		String id = UUIDUtils.shortUuidAddTime();
		record.setJobTimerId(id);
		int result = jobTimerRepository.insert(record);
		if ( result != 1) { 
			return "新增任务跑批时间失败！";
		} 
		return null;
	}

	public String updateByCriteria(Criteria<JobTimer> param){
		int result = jobTimerRepository.updateByCriteria(param);
		if ( result != 1) { 
			return "修改任务跑批时间失败！";
		} 
		return null;
	}

	public String deleteById(String id){
		int result = jobTimerRepository.deleteById(id);
		if ( result != 1) { 
			return "删除任务跑批时间失败！。";
		} 
		return null;
	}

	public String deleteByCriteria(Criteria<JobTimer> param){
		jobTimerRepository.deleteByCriteria(param);
		return null;
	}

	public void setJobTimerRepository(IJobTimerRepository repository) {this.jobTimerRepository = repository;}
	private IJobTimerRepository jobTimerRepository;

}
